package com.klb.model;

import javax.persistence.*;
import java.sql.Date;
import java.sql.Time;

/**
 * Created by fujia on 2016/7/2.
 */
@Entity
@Table(name = "bbs_reply", schema = "knowlogebase", catalog = "")
public class BbsReply {
    private int replyId;
    private int userId;
    private int articleId;
    private String text;
    private Date dateAdded;
    private Time timeAdded;

    @Id
    @Column(name = "reply_id", nullable = false)
    public int getReplyId() {
        return replyId;
    }

    public void setReplyId(int replyId) {
        this.replyId = replyId;
    }

    @Basic
    @Column(name = "user_id", nullable = false)
    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    @Basic
    @Column(name = "article_id", nullable = false)
    public int getArticleId() {
        return articleId;
    }

    public void setArticleId(int articleId) {
        this.articleId = articleId;
    }

    @Basic
    @Column(name = "text", nullable = false, length = 500)
    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    @Basic
    @Column(name = "date_added", nullable = false)
    public Date getDateAdded() {
        return dateAdded;
    }

    public void setDateAdded(Date dateAdded) {
        this.dateAdded = dateAdded;
    }

    @Basic
    @Column(name = "time_added", nullable = false)
    public Time getTimeAdded() {
        return timeAdded;
    }

    public void setTimeAdded(Time timeAdded) {
        this.timeAdded = timeAdded;
    }

    @Override
    public boolean equals(Object object) {
        if (this == object) return true;
        if (object == null || getClass() != object.getClass()) return false;

        BbsReply reply = (BbsReply) object;

        if (replyId != reply.replyId) return false;
        if (userId != reply.userId) return false;
        if (articleId != reply.articleId) return false;
        if (text != null ? !text.equals(reply.text) : reply.text != null) return false;
        if (dateAdded != null ? !dateAdded.equals(reply.dateAdded) : reply.dateAdded != null) return false;
        if (timeAdded != null ? !timeAdded.equals(reply.timeAdded) : reply.timeAdded != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = replyId;
        result = 31 * result + userId;
        result = 31 * result + articleId;
        result = 31 * result + (text != null ? text.hashCode() : 0);
        result = 31 * result + (dateAdded != null ? dateAdded.hashCode() : 0);
        result = 31 * result + (timeAdded != null ? timeAdded.hashCode() : 0);
        return result;
    }
}
